package com.thingsgrid.common.constant;

import org.springblade.core.launch.constant.AppConstant;

/**
 * 通用常量
 *
 * @author Chill
 */
public interface CommonConstant {

	/**
	 * 应用管理
	 */
	String APPLICATION_APPOPERATIONS_NAME = AppConstant.APPLICATION_NAME_PREFIX+ "application-manager";

	/**
	 * 设备
	 */
	String APPLICATION_DEVICE_NAME = AppConstant.APPLICATION_NAME_PREFIX + "device";

	/**
	 * 应用状态监控
	 */
	String APPLICATION_APPLICATIONMONITOR_NAME = AppConstant.APPLICATION_NAME_PREFIX+ "application-monitor";

	/**
	 * 固件
	 */
	String APPLICATION_FIRMWARE = AppConstant.APPLICATION_NAME_PREFIX + "firmware";

	/**
	 * MQTT
	 */
	String APPLICATION_MQTT_NAME = AppConstant.APPLICATION_NAME_PREFIX + "mqtt-helper";

	/**
	 * 设备监控
	 */
	String APPLICATION_DEVICE_MONITOR_NAME = AppConstant.APPLICATION_NAME_PREFIX + "device-monitor";

	/**
	 * 物模型
	 */
	String APPLICATION_PHYSICAL_MODEL = AppConstant.APPLICATION_NAME_PREFIX + "physical-model";

	/**
	 * 产品
	 */
	String APPLICATION_PRODUCT_NAME = AppConstant.APPLICATION_NAME_PREFIX + "product";


	/**
	 * nacos dev 地址
	 */
	String NACOS_DEV_ADDR = "192.168.43.1:8848";

	/**
	 * nacos prod 地址
	 */
	String NACOS_PROD_ADDR = "192.168.43.1:8848";

	/**
	 * nacos test 地址
	 */
	String NACOS_TEST_ADDR = "192.168.43.1:8848";

	/**
	 * sentinel dev 地址
	 */
	String SENTINEL_DEV_ADDR = "192.168.43.1:8858";

	/**
	 * sentinel prod 地址
	 */
	String SENTINEL_PROD_ADDR = "192.168.0.57:8858";

	/**
	 * sentinel test 地址
	 */
	String SENTINEL_TEST_ADDR = "172.30.0.58:8858";

	/**
	 * sword 系统名
	 */
	String SWORD_NAME = "sword";

	/**
	 * saber 系统名
	 */
	String SABER_NAME = "saber";

	/**
	 * 顶级父节点id
	 */
	Long TOP_PARENT_ID = 0L;

	/**
	 * 顶级父节点名称
	 */
	String TOP_PARENT_NAME = "顶级";

	/**
	 * 应用仓库地址
	 */
	String HARBOR_IP="";

	/**
	 * SSH连接端口
	 */
	String SSH_IP="";

	/**
	 * SSH登录用户名
	 */
	String SSH_USERNAME = "";

	/**
	 * SSH登录密码
	 */
	String SSH_PASSWORD = "";

	/**
	 * 默认密码
	 */
	String DEFAULT_PASSWORD = "123456";

	/**
	 * 动态获取nacos地址
	 *
	 * @param profile 环境变量
	 * @return addr
	 */
	static String nacosAddr(String profile) {
		switch (profile) {
			case (AppConstant.PROD_CODE):
				return NACOS_PROD_ADDR;
			case (AppConstant.TEST_CODE):
				return NACOS_TEST_ADDR;
			default:
				return NACOS_DEV_ADDR;
		}
	}

	/**
	 * 动态获取sentinel地址
	 *
	 * @param profile 环境变量
	 * @return addr
	 */
	static String sentinelAddr(String profile) {
		switch (profile) {
			case (AppConstant.PROD_CODE):
				return SENTINEL_PROD_ADDR;
			case (AppConstant.TEST_CODE):
				return SENTINEL_TEST_ADDR;
			default:
				return SENTINEL_DEV_ADDR;
		}
	}

}
